package com.polimi.meteocal.business.entity;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the ack database table.
 * 
 */
@Embeddable
public class AckPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(name="EVENT_ID", insertable=false, updatable=false)
	private int eventId;

	@Column(name="ACK_RECEIVER", insertable=false, updatable=false)
	private String ackReceiver;

	@Column(name="ACK_SENDER", insertable=false, updatable=false)
	private String ackSender;

	public AckPK() {
	}
	public int getEventId() {
		return this.eventId;
	}
	public void setEventId(int eventId) {
		this.eventId = eventId;
	}
	public String getAckReceiver() {
		return this.ackReceiver;
	}
	public void setAckReceiver(String ackReceiver) {
		this.ackReceiver = ackReceiver;
	}
	public String getAckSender() {
		return this.ackSender;
	}
	public void setAckSender(String ackSender) {
		this.ackSender = ackSender;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof AckPK)) {
			return false;
		}
		AckPK castOther = (AckPK)other;
		return 
			(this.eventId == castOther.eventId)
			&& this.ackReceiver.equals(castOther.ackReceiver)
			&& this.ackSender.equals(castOther.ackSender);
	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.eventId;
		hash = hash * prime + this.ackReceiver.hashCode();
		hash = hash * prime + this.ackSender.hashCode();
		
		return hash;
	}
}